package com.wangxq.loginmodule.yd_login.login.mvp.model;

import android.app.Application;
import com.google.gson.Gson;
import com.jess.arms.base.delegate.sys.LoginReponsBody;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject;

import com.wangxq.loginmodule.yd_login.login.LoginApi;
import com.wangxq.loginmodule.yd_login.login.mvp.contract.LoginType2Contract;
import com.zlx.module_base.sys_info.BaseResponsBean;

import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;


@ActivityScope
public class LoginType2Model extends BaseModel implements LoginType2Contract.Model{
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public LoginType2Model(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseResponsBean<LoginReponsBody>> Login(String url, String username, String password) {
        return mRepositoryManager.obtainRetrofitService(LoginApi.class).Login(url,username,password)
                .subscribeOn(Schedulers.io());
    }
}